﻿<!--HEADER-->
<cms-page-header cms-title="Page Templates"></cms-page-header>

<cms-page-sub-header>
    <cms-page-header-buttons>

        <a class="btn-icon" cms-text="Filter"
           ng-click="vm.toggleFilter()">
            <i class="fa fa-search"></i>
        </a>

        <!--FILTER-->
        <cms-search-filter cms-query="vm.query"
                           cms-filter="vm.filter"
                           ng-show="vm.isFilterVisible">

            <cms-form-field-text cms-title="Name"
                                 cms-model="vm.filter.name"></cms-form-field-text>

        </cms-search-filter>

    </cms-page-header-buttons>
</cms-page-sub-header>

<!-- Default toolbar -->
<cms-page-actions ng-show="!vm.editMode">

    <!--RESULTS-->
    <cms-pager cms-result="vm.result"
               cms-query="vm.query"></cms-pager>

</cms-page-actions>

<!-- Scrollable content area -->
<cms-page-body cms-content-type="form">

    <cms-table-container cms-loading="vm.gridLoadState.isLoading">
        <table>
            <thead>
                <tr>
                    <th>Name</th>
                    <th>File Name</th>
                    <th>Regions</th>
                    <th>Pages</th>
                    <th>Updated</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-if="!vm.result.items.length">
                    <td colspan="100" class="empty">Sorry, no page templates could be found.</td>
                </tr>
                <tr ng-repeat="pageTemplate in vm.result.items">
                    <td>
                        <a href="#/{{::pageTemplate.pageTemplateId}}">{{::pageTemplate.name}}</a>
                    </td>
                    <td>
                        {{::pageTemplate.fileName}}
                    </td>
                    <td>
                        {{::pageTemplate.numRegions}}
                    </td>
                    <td>
                        <a href="{{::vm.urlLibrary.pageList({ pageTemplateId: pageTemplate.pageTemplateId })}}">{{::pageTemplate.numPages}}</a>
                    </td>
                    <td class="lowPriority">
                        <cms-time-ago cms-time="::pageTemplate.updateDate"></cms-time-ago>
                    </td>
                </tr>
            </tbody>
        </table>
    </cms-table-container>

</cms-page-body>
